package com.example.demo;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sentinel")
public class SentinelController {

    private static final Logger log = LoggerFactory.getLogger(SentinelApplication.class);

    @GetMapping("/index")
    @SentinelResource("sentinel_index")
    public String index() {
        log.info("111111");
        return "sentinel_index!";
    }

    @GetMapping("/test")
    @SentinelResource("sentinel_test")
    public String test() {
        log.info("222222");
        return "sentinel_test!";
    }
}
